This repository was archived by the owner on Jul 6, 2026. It is now read-only.
mgmt azure-json, fix flattened properties in parent class#2817
Merged
Conversation
XiaofeiCao
marked this pull request as ready for review
June 14, 2024 08:51
XiaofeiCao
requested review from
haolingdong-msft,
srnagar and
weidongxu-microsoft
as code owners
June 14, 2024 08:51
weidongxu-microsoft
approved these changes
Jun 17, 2024
XiaofeiCao
commented
Jun 17, 2024
Comment on lines
558
to
+560
| */ | ||
| public static boolean hasSetter(ClientModelPropertyAccess property, JavaSettings settings) { | ||
| // If the property isn't read-only or required and part of the constructor, and it isn't private, | ||
| // add a setter. | ||
| return !isReadOnlyOrInConstructor(property, settings) && !isPrivateAccess(property); | ||
| } | ||
|
|
||
| // A property has private access when it is to be flattened. | ||
| // Only applies to mgmt, no effect on vanilla or DPG. | ||
| private static boolean isPrivateAccess(ClientModelPropertyAccess property) { | ||
| boolean privateAccess = false; | ||
| // ClientModelPropertyReference never refers to a private access property, so only check ClientModelProperty here. | ||
| if (property instanceof ClientModelProperty) { | ||
| privateAccess = ((ClientModelProperty) property).getClientFlatten(); | ||
| } | ||
| return privateAccess; | ||
| public static boolean needsPublicSetter(ClientModelPropertyAccess property, JavaSettings settings) { | ||
| return !isReadOnlyOrInConstructor(property, settings) && !isFlattenedProperty(property); |
Contributor
Author
There was a problem hiding this comment.
Refactor to make this method's purpose more clear.
alzimmermsft
approved these changes
Jun 17, 2024
Member
|
You may do a follow-up PR to change the default (for Swagger) to true, and see how it works for existing test and the generation action https://github.com/Azure/autorest.java/actions/workflows/fluent-test-gen-all.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fromJson, set shadowed flattened property, instead of the package private setterRegened compute and network,
mvn verifypassed for both.